//ip黑名单
"use strict"
const mvc = require("cosjs.mvc");
const dbase = require('../dbase');

class ipblock extends dbase.branch.mongodb {
    constructor(branch){
        super(branch,'ipblock');
    }
    verify(ip){
        if(!ip){
            return Promise.resolve(false);
        }
        ip = ip.replace("::ffff:",'');
        let key = ["_id"];
        return this.get(ip,key).then(ret=>{
            if(!ret){
                return false;
            }
            else {
                return true;
            }
        })
    }
}


module.exports = function(branch){
    return new ipblock(branch);
}